package cn.com.edu.nju.ecrec.dao;

public class DaoFactory {
	private static DaoFactory factory;

	public static synchronized DaoFactory getInstance() {
		if (factory == null)
			factory = new DaoFactory();
		return factory;
	}
	
	public <T extends AbstractDao> T getDao(String className) {
		try {
			return (T) Class.forName(
					"cn.com.edu.nju.ecrec.dao.impl." + className + "DaoImpl")
					.newInstance();
		} catch (Exception ex) {
			ex.printStackTrace();
			return null;
		}
	}
}